﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using BE;
using BLL;



namespace Testing
{
	class Program
	{
		static void Main( string[] args )
		{
			//TestGraph2();
		}

		static private void TestGraph2()
		{
			Graph map = new Graph();
			VertexWorker vw = new VertexWorker();
			EdgeWorker ew = new EdgeWorker();
			map.UpdateGraph( vw.GetDictionariedVertices(), ew.GetAll() );
			List<string> ll = new List<string>();
			int i = 0;
			foreach ( string s in map.Edges.Keys )
			{
				ll.Add( s );
			}
			foreach ( EdgeGraph e in map.Edges.Values )
			{
				Console.WriteLine(ll[i]+": "+e.Name+":"+e.TotalWeight+" - "+e.L1+","+e.L2);
				i++;
			}
			Console.WriteLine("Press A key to get Room Direction from A to C");
			Console.WriteLine();
			Console.ReadKey();
			Room start = new Room("A1",1);
			Room end = new Room("D2",6);
			List<Edge> l = map.GetPath( start, end );
			List<string>  d=  map.getDirections( l );
			foreach ( string s in d )
				Console.WriteLine( s );
			Console.ReadKey();
		}

		//to test if you had to remove a value at given index before adding to that index
		//and testing if trygetvalue returned a reference to an object or a copy of an object
		static private void SortedDictionaryCopyRemoveTest()
		{
		SortedDictionary<int, string> testlist = new SortedDictionary<int, string>();
			testlist.Add( 1, "test" );
			testlist.Remove( 1 );
			testlist.Add( 1, "nigga" );
			string l = "";
			testlist.TryGetValue( 1,out l);
			Console.WriteLine(l);
			l = "another";
			string s;
			testlist.TryGetValue( 1, out s );
			Console.WriteLine(s+" "+l);
			s = "shaddap";
			testlist.ToString();
			Console.ReadKey();
		}

		private static void TestGraph()
		{
			VertexWorker vw = new VertexWorker();
			EdgeWorker ew = new EdgeWorker();
			Graph g = new Graph();
			g.FillGraph(vw.GetDictionariedVertices(),ew.GetAll());
			foreach (GraphVertex e in g.Vertices.Values )
			{
				Console.WriteLine("Vertex: "+e.Name);
			}
			foreach ( EdgeGraph e in g.Edges.Values )
			{
				Console.WriteLine( "Edge: " + e.Name );
			}
		}

		private static void DeleteVertex()
		{
				  VertexWorker v = new VertexWorker();
				//v.Delete(new Vertex(2,"sd"));
		}

        static private void allVertices()
        {
            VertexWorker vw = new VertexWorker();
			List<Vertex> l = vw.GetAll();
			foreach ( Vertex v in l )
				Console.WriteLine(v.Name);
			Console.ReadKey();
        }

        static private void allRooms()
        {
            RoomWorker r = new RoomWorker();
            List<Room> rm = r.GetAllRooms();
            foreach (Room room in rm)
                Console.WriteLine(room.Name + ", " + room.LocationID + ", " + room.ID);
            Console.ReadKey();
        }

		static private void EditVertex()
		{
			VertexWorker rm=new VertexWorker();
			Vertex r = new Vertex( 1, "shitniggg");
            //rm.Edit( r );
		}
	}
}
